#ifndef FeatureVector_H
#define FeatureVector_H
#include<list>
#include"Feature.h"
#include<vector>
#include"boost/unordered_map.hpp"
using namespace std;
using namespace boost;

class Term{
public:
	int index;
	double value;
};

class Hash_Map{
private:
	Term(*table)[3];
	int* lengths;
	int size;
	int bucket_size;
public:
	Hash_Map(int size);
	bool put(int key, double value);
	double get(int key);
	~Hash_Map();
};

class FeatureVector:public vector<Feature>{
private:

	int addFeaturesToMap(Hash_Map &map, bool negative, vector<int> &keys, int start);
	void addFeaturesToMap(Hash_Map &map, bool negative);
	void toString(string* str);
	FeatureVector* previous1;
	FeatureVector* previous2;
	bool negativeSecond;
public:
	FeatureVector();
	FeatureVector(FeatureVector* fv1, FeatureVector* fv2, bool negSecond);
	void construct(int *keys, int size);
	~FeatureVector();

	void add(int index, double value);
	int* keys();
	void cat(FeatureVector* f1, FeatureVector* f2);
	void extend(FeatureVector *f12);
	FeatureVector* getDistVector(FeatureVector* f12);
	double getScore(double* parameters);
	void update(double* parameters, double* total, double alpha_k, double upd);
	double dotProduct(FeatureVector &f12);
	string* toString();
};
#endif
